//
//  PhotoCollectionViewCell.m
//  UcarTest
//
//  Created by 陈曦 on 16/3/24.
//  Copyright © 2016年 chenxi. All rights reserved.
//

#import "PhotoCollectionViewCell.h"
#import "Define.h"
#import "UIImageView+WebCache.h"
#import "NetRequestGroup.h"


@implementation PhotoCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        //图片
        self.photoImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (kScreenWidth - 42) / 3, (kScreenWidth - 42) / 3)];
        self.photoImageV.layer.cornerRadius = 3;
        self.photoImageV.layer.masksToBounds = YES;
        [self addSubview:self.photoImageV];
        
        
        //时间显示
        self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, (kScreenWidth - 42) / 3, (kScreenWidth - 42) / 3 + 10, 12)];
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        self.timeLabel.textAlignment  = NSTextAlignmentCenter;
        self.timeLabel.textColor = labelTextColor;
        [self addSubview:self.timeLabel];
        
    }
    return self;
}

- (void)setModel:(CheckOutPhotoCarOwnerModel *)model{
    
    _model = model;
            
    NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRealmNameImage,model.img_small];
    [_photoImageV  sd_setImageWithURL:[NSURL URLWithString:urlStr]];
            
    //字符串转换成时间戳
    NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[model.add_time intValue]];
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init];
    [dateFormat setDateFormat:@"yyyy-MM-dd HH:mm "];
    _timeLabel.text = [dateFormat stringFromDate:confromTimesp];

}

//点击图片放大








@end
